home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / mlib / examples / example3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-16  |  871 b   |  40 lines

  1. #include <mio.h>
  2. #include <mgr.h>
  3.  
  4. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  5.   int               main ()
  6. /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
  7. {
  8. MImage screen (MAXX,MAXY);
  9.  
  10.     initgraph();
  11.     keyb.KeyFlush();   // Clear the keyboard buffer
  12.  
  13.     while (!keyb.KeyPress())
  14.     {
  15.        setcolor (random (256));
  16.        line (random (320), random(200),random (320), random(200));
  17.     }
  18.     keyb.KeyFlush();
  19.  
  20.     screen.Get (0,0);
  21.     screen.Save ("screen.pix");
  22.     screen.Clear();
  23.  
  24.     cleardevice();
  25.     setcolor (65);
  26.     outtextxy (50,50, "The image has been saved in 'screen.pix'");
  27.     outtextxy (70,70, "Press any key to restore...");
  28.  
  29.     while (!keyb.KeyPress());
  30.     
  31.     screen.Load ("screen.pix");
  32.     screen.Put (0,0);
  33.  
  34.     keyb.KeyFlush();
  35.     while (!keyb.KeyPress());
  36.  
  37.     closegraph();
  38.     return (0);
  39. }
  40.